<!DOCTYPE HTML>
<html>
<head>
<#include "/adminPage/common.html"/>
<style type="text/css">
#detailDiv img {
	max-height: 200px;
	cursor: pointer;
}

td {
	word-break: break-all;
	word-wrap: break-word;
}

.status {
	font-weight: bolder;
	margin-top: 20px;
	padding: 5px;
	background-color: #DDDDDD;
}

.mark {
	border: 1px solid #DDDDDD;
	padding: 5px;
}

.ck-content {
	height: 300px;
}
</style>
</head>
<body class="layui-layout-body">
	<div class="layui-layout layui-layout-admin">

		<#include "/adminPage/header.html"/>
		<#include "/adminPage/menu.html"/>

		<div class="layui-body">
			<!-- 内容主体区域 -->
			<div style="padding: 15px">
				<fieldset class="layui-elem-field layui-field-title">
					<legend>${stageName}</legend>
				</fieldset>

				<form action="${ctx}/adminPage/function?functionStatus=${functionStatus}" id="searchForm" method="post">
					<div class="layui-form search">
						<button type="button" class="layui-btn layui-btn-normal" onclick="add()">添加任务</button>

						<div class="layui-inline">
							<label class="layui-form-label">负责人</label>
						</div>

						<div class="layui-inline" style="width: 150px;">
							<select name="userId">
								<option value="">--全部--</option>
								<#list userList as user>
								<option value="${user.id}" ${(user.id==userId)?string('selected','')}>${user.trueName}(${user.typeName})</option>
								</#list>
							</select>
						</div>

						<div class="layui-inline">
							<label class="layui-form-label">创建人</label>
						</div>

						<div class="layui-inline" style="width: 150px;">
							<select name="createUserId">
								<option value="">--全部--</option>
								<#list userList as user>
								<option value="${user.id}" ${(user.id==createUserId)?string('selected','')}>${user.trueName}(${user.typeName})</option>
								</#list>
							</select>
						</div>

						<div class="layui-inline">
							<label class="layui-form-label">紧急程度</label>
						</div>

						<div class="layui-input-inline" style="width: 100px;">
							<select name="level">
								<option value="">--全部--</option>
								<option ${(level== 0)?string('selected','')} value="0">低级</option>
								<option ${(level== 1)?string('selected','')} value="1">中级</option>
								<option ${(level== 2)?string('selected','')} value="2">紧急</option>
								<option ${(level== 3)?string('selected','')} value="3">特急</option>
							</select>
						</div>

						<button type="button" class="layui-btn" onclick="search()">搜索</button>
						<input type="hidden" name="pageNum" value="${page.pageNum}">
					</div>
				</form>

				<table class="layui-table">
					<thead>
						<tr>
							<th style="width: 400px;">任务名</th>
							<th>类型</th>
							<th style="width: 180px;">负责人</th>
							<th>创建人</th>
							<th>截止时间</th>
							<th>难度</th>
							<th>紧急程度</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody>
						<#list page.records as functionResp>
						<tr>
							<td>${functionResp.name}</td>
							<td>
								<#if functionResp.type==0> 需求 </#if>
								<#if functionResp.type==1> Bug </#if>
							</td>
							<td>${functionResp.userNames}</td>
							<td>${functionResp.createUser.trueName}</td>
							<td>${functionResp.endTime}</td>
							<td>${functionResp.point}</td>
							<td>${functionResp.levelName}</td>

							<td>
								<div class="layui-inline">
									<button class="layui-btn layui-btn-sm layui-btn-normal" onclick="detail('${functionResp.id}')">查看详情</button>
								</div>
								<div class="layui-inline">
									<button class="layui-btn layui-btn-sm layui-btn-normal" onclick="test('${functionResp.id}')">添加日志</button>
								</div>
								<div class="layui-inline">
									<button class="layui-btn layui-btn-sm" onclick="edit('${functionResp.id}')">编辑</button>
								</div>
								<div class="layui-inline">
									<button class="layui-btn layui-btn-sm" onclick="move('${functionResp.id}')">转移</button>
								</div>
							</td>
						</tr>
						</#list>
					</tbody>
				</table>

				<div id="pageInfo"></div>
			</div>
		</div>
	</div>

	<div style="height: 0px; width: 0px; overflow: hidden;">
		<!-- 弹出框 -->
		<div class="layui-form" id="windowDiv" style="padding: 15px; display: none">
			<form id="addForm">
				<input type="hidden" name="id" id="id">
				<input type="hidden" name="functionStatus" value="${functionStatus}">

				<div class="layui-form-item">
					<label class="layui-form-label">
						任务名
						<span class="red">*</span>
					</label>
					<div class="layui-input-block">
						<input type="text" name="name" id="name" class="layui-input">
					</div>
				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">
						负责人
						<span class="red">*</span>
					</label>
					<div class="layui-input-block">
						<#list userList as user> <input type="checkbox" name="userIds" id="users_${user.id}" value="${user.id}" lay-skin="primary" title="${user.trueName}(${user.typeName})"> </#list>
					</div>
				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">类型</label>
					<div class="layui-input-inline" style="width: 100px;">
						<select name="type" id="type">
							<option value="1">Bug</option>
							<option value="0">需求</option>

						</select>
					</div>

					<label class="layui-form-label">紧急程度</label>
					<div class="layui-input-inline" style="width: 100px;">
						<select name="level" id="level">
							<option value="0">低级</option>
							<option value="1">中级</option>
							<option value="2">紧急</option>
							<option value="3">特急</option>
						</select>
					</div>

					<label class="layui-form-label">任务难度</label>
					<div class="layui-input-inline" style="width: 100px;">
						<select name="point" id="point">
							<option>1</option>
							<option>2</option>
							<option>3</option>
							<option>4</option>
							<option>5</option>
							<option>6</option>
							<option>7</option>
							<option>8</option>
							<option>9</option>
							<option>10</option>
						</select>
					</div>

					<label class="layui-form-label">
						截止时间
						<span class="red">*</span>
					</label>
					<div class="layui-input-inline" style="width: 100px;">
						<input type="text" name="endTime" class="layui-input laydate" readonly="readonly">
					</div>
				</div>


				<div class="layui-form-item">
					<label class="layui-form-label">任务内容</label>
					<div class="layui-input-block">
						<div name="editor" id="editor"></div>

						<input type="hidden" id="content" name="content">
					</div>
				</div>

				<div class="layui-form-item center">
					<button type="button" class="layui-btn layui-btn-normal" onclick="addOver()">提交</button>
					<button type="button" class="layui-btn" onclick="layer.closeAll()">关闭</button>
				</div>
			</form>
		</div>



		<div class="layui-form" id="moveDiv" style="padding: 15px; display: none">
			<form id="moveForm">
				<input type="hidden" name="functionId" id="functionId">


				<div class="layui-form-item">
					<label class="layui-form-label">转移阶段</label>
					<div class="layui-input-block">
						<select name="status" id="status">
							<option value="0">等待阶段</option>
							<option value="1">开发阶段</option>
							<option value="2">测试阶段</option>
							<option value="5">验证阶段</option>
							<option value="3">完成阶段</option>
							<option value="4">否决阶段</option>
						</select>
					</div>
				</div>

				<div class="layui-form-item center">
					<button type="button" class="layui-btn layui-btn-normal" onclick="moveOver()">提交</button>
					<button type="button" class="layui-btn" onclick="layer.closeAll()">关闭</button>
				</div>
			</form>
		</div>


		<div class="layui-form" id="testDiv" style="padding: 15px; display: none">
			<form id="testForm">
				<input type="hidden" name="functionId" id="functionId2">

				<div class="layui-form-item">
					<label class="layui-form-label">
						指派给
						<span class="red">*</span>
					</label>
					<div class="layui-input-block">
						<#list userList as user> <input type="checkbox" name="userIds" id="users_${user.id}_test" value="${user.id}" lay-skin="primary" title="${user.trueName}(${user.typeName})"> </#list>
					</div>
				</div>


				<div class="layui-form-item">
					<label class="layui-form-label">日志内容</label>
					<div class="layui-input-block">
						<div name="editor" id="editor2"></div>

						<input type="hidden" id="changeMark" name="changeMark">
					</div>
				</div>


				<div class="layui-form-item center">
					<button type="button" class="layui-btn layui-btn-normal" onclick="testOver()">提交</button>
					<button type="button" class="layui-btn" onclick="layer.closeAll()">关闭</button>
				</div>
			</form>


		</div>

		<div class="layui-form" id="detailDiv" style="padding: 15px; display: none">
			<div id="title" style="font-weight: bolder; font-size: 16px;"></div>
			<div id="detail" style="margin-top: 10px;"></div>

			<div>

				<div id="markList"></div>

			</div>


		</div>
	</div>
	<script src="${ctx}/js/adminPage/function/index.js?v=${jsrandom}" type="text/javascript"></script>
</body>


</html>